﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public abstract class Step  
{
    private static Stack<Step> stepStack = new Stack<Step>();
    public virtual void Enter(Step step)
    {
        stepStack.Push(step);
        Init();
    }

    public virtual void Enter()
    {
        Init();
    }

    public virtual void Exit()
    {
        BeforeExit();
        if(stepStack.Count > 0)
        {
            var step = stepStack.Pop();
            step.Enter();
        }
    }

    public abstract void Init();
    public abstract void BeforeExit();
}
